<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$setting=$this->plugin_setting('basic');
$return['banner']=$setting['hdps'];
$return['setting']=$setting;
if($_RQ['op']=='main'){
	$params=array('uniacid'=>$_SESSION['uniacid']);
	$return['params']=array('iszhuan'=>$_RQ['type']?1:0);
	$parentid=intval($_RQ['id'])?:intval($_RQ['parentid']);
	if($parentid){
		$return['params']['id']=$return['params']['groupid']=$parentid;
		$url=custom_url('jy_lineks/group/id='.$parentid,true);
		$params['id']=$parentid;
		$groupnum=pdo_count('jy_lineks_group',array('uniacid'=>$_SESSION['uniacid'],'status'=>'1','parentid'=>$parentid));
	}
	$group=pdo_get('jy_lineks_group',$params);
	$return['group']=$group;
	$return['list']=array();
	$return['sharedata']=array(
		'title'=>$group['title'],
		'desc'=>$group['desc'],
		'link'=>$url,
		'imgUrl'=>tomedia($group['image']),
	);
	$return['action']='jy_lineks/group';
	set_html('title',$group['title']);
	exi($return);
}
if($_RQ['op']=='getcanyu'){
	if(!$_RQ['id']){
		exi('没有找到该考卷，请重新选择！','error');
	}
	$item=pdo_get('jy_lineks_tiku_zu',array('uniacid'=>$_SESSION['uniacid'],'id'=>$_RQ['id']));
	$this->model('model')->check_iscard($item);
	$datis=pdo_getall('jy_lineks_list',array('uniacid'=>$_SESSION['uniacid'],'zu_id'=>$item['id']),array('id'),'id');
	$parameter=array(
			'params'=>array('issub'=>1,'mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),
			'orderby'=>'id desc',
			'limit'=>'1',
	);
	if($datis){
		$datis=array_keys($datis);
		$parameter['params']['datiid']=$datis;
	}
	$canyu=$this->get_list('canyu',$parameter);
	$canyu=$canyu[0];
	$dati=pdo_get('jy_lineks_tiku_zu',array('uniacid'=>$_SESSION['uniacid'],'id'=>$datis[0]));
	$typenum=$dati['typenum'];
	$typenum=json_decode($typenum,true);
	$return['item']=$item;
	$return['dati']=$dati;
	$return['post']=array();
	$canyu['desc']='本次考试单选题'.$typenum['type4'].'道，判断题'.$typenum['type20'].'道，多选题'.$typenum['type5'].'道，及格线'.$dati['jigescore'].'分';
	$return['canyu']=$canyu;
	exi($return);
}
